#! /usr/bin/env python

from waf_dynamo import dmsdk_add_files

def configure(conf):
    pass

def build(bld):
    proto_files = ['../proto/rig/rig_ddf.proto']

    bld.stlib(features        = 'cxx ddf',
              includes        = ['.', '..', '../proto'],
              proto_gen_py    = True,
              protoc_includes = '../proto',
              target          = 'rig',
              use             = 'DDF DLIB SOCKET',
              source          = ['rig.cpp'] + proto_files)

    bld.add_group()

    bld.stlib(features        = 'cxx ddf',
              includes        = ['.', '..', '../proto'],
              proto_gen_py    = True,
              protoc_includes = '../proto',
              target          = 'rig_null',
              use             = 'DDF DLIB SOCKET',
              source          = ['rig_null.cpp'] + proto_files)

    bld.add_group()

    # We only need this library in the editor
    if bld.env.IS_TARGET_DESKTOP:
        bld.shlib(features        = 'cxx ddf skip_asan',
                  includes        = ['.', '..', '../proto'],
                  target          = 'rig_shared',
                  protoc_includes = '../proto',
                  use             = 'DDF_NOASAN DLIB_NOASAN PROFILE_NULL_NOASAN SOCKET PLATFORM_NULL GRAPHICS_NULL_NOASAN',
                  source          = 'rig.cpp ../proto/rig/rig_ddf.proto')

    bld.install_files('${PREFIX}/include/rig', 'rig.h')
    bld.install_files('${PREFIX}/share/proto', '../proto/rig/rig_ddf.proto')

    bld.recurse('test')

    dmsdk_add_files(bld, '${PREFIX}/sdk/include/dmsdk', 'dmsdk')
